﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BitPortal.Models;
using BitPortal.Business;
using BitPortal.Utils;
using Ext.Net;

namespace BitPortal.Admin.Service.ProductCustomer
{
    public partial class Default : Controls.BaseAdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //(new Models.ErrorReport()).e
            //(new Models.ProductCustomer()).ErrorReports.

        }


        protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
        {
            List<Models.ErrorReport> data=null;
            if (Session["ErrorGridFlag"] != null && Session["ErrorGridFlag"].Equals(false))
            {
                ExtendedBitPortalEntities bitEnt = new ExtendedBitPortalEntities();
                data = bitEnt.ErrorReports.Where(ent => ent.IsDeleted == true).ToList();
            }
            else
            {
                long id = GeneralUtils.ToInt64TryParse(Request.QueryString["ErrorID"]);

                if (id != 0)
                {
                    data = ErrorReportBLL.GetAllErrors(id).ToList();
                }
                
            }
            FilterConditions fc = null;
            string s = e.Parameters[this.GridFilters1.ParamPrefix];
            if (!string.IsNullOrEmpty(s))
            {
                fc = new FilterConditions(s);
            }
            this.Store1.DataSource = ExtNet.GirdData.Filter<Models.ErrorReport>(data, fc, e);
        }
    }
}